package com.biz.primus.ms.promotion.dao.po;

import com.biz.primus.ms.base.jpa.po.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 简单特价商品JPA Entity
 *
 * @author david-liu
 */
@Entity
@Table(name = "pmt_special_offer_product")
@Getter
@Setter
public class SpecialOfferPromotionProduct extends BaseEntity {
    private static final long serialVersionUID = 486524701845006400L;

    /**
     * 简单特价活动
     */
    @ManyToOne
    private SpecialOfferPromotion specialOfferPromotion;

    /**
     * 特价商品ID
     */
    @Column(nullable = false)
    private Long productId;

    /**
     * 特价(单位: 分)
     */
    @Column(nullable = false)
    private Integer specialOfferPrice;

    /**
     * 限购数量(如果为空, 不限购)
     */
    private Integer purchaseQuantityLimit;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
